<?php

/*
  |--------------------------------------------------------------------------
  | Web Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register web routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | contains the "web" middleware group. Now create something great!
  |
 */

//Route::get('/', function () {
//    return view('welcome');
//})->middleware("admin.login");
Route::group(['namespace' => 'admin', 'prefix' => 'admin','middleware' => 'admin.login'], function() {
            //后台首页
            Route::get('/', 'IndexController@index');
            Route::get('top','IndexController@top');//首页顶部
    
            //后台管理员列表
            Route::resource('admin', 'AdminController');


            //Ajax修改管理员状态的路由
            Route::post('admin/AjaxStatus', 'AdminController@AjaxStatus'); 
          
            //后台分类列表
            Route::resource('goods_category', 'GoodsController');

            //后台分类似是否显示的状态个更改
            Route::post('goods/ExitStatus', 'GoodsController@ExitStatus');

            //后台分类管理的批量删除
            Route::post('goods/all_del', 'GoodsController@all_del');
            
            //后台商品管理
            Route::resource('types','TypesController');
            
//            Route::any('uploads', 'TestController@uploadImages');//测试上传图片所用 
            //后台商品的修改
            Route::post('types/updates',"TypesController@updates");
            
            //后台商品的批量删除
            Route::post('types/all_del', 'TypesController@all_del');
            
            //后台商品名称的搜索功能
            Route::post('types/res', 'TypesController@res');
            
            Route::post('types/ExitStatus', 'TypesController@ExitStatus');
            
            Route::get('config/sitting','ConfigController@sitting');//网站的基本配置列表
            
            Route::post('config/add','ConfigController@add');//网站的基本配置列表
            
            Route::get('ads/ads_list','AdsController@ads_list');//轮播图列表
            
            Route::get('ads/ads_add','AdsController@ads_add');//轮播图添加页面
            
            Route::post('ads/store','AdsController@store');//轮播图添加处理 
            
            Route::get('ads/edit/{id}','AdsController@edit');//轮播图修改页面
            
            Route::post('ads/ads_edit','AdsController@ads_edit');//轮播图添加处理 
            
            Route::delete('ads/del/{id}','AdsController@del');//轮播图删除方法 
            
            Route::resource('users', 'UsersController');//后台会员列表
            Route::post('users/ExitStatus', 'UsersController@ExitStatus');//修改会员是否验证
            Route::get('users/account/{id}','UsersController@account');//会员资金管理页面
            Route::post("users/cashEdit","UsersController@cashEdit");//资金修改
            Route::get("users/comments/{id}","UsersController@comments");//会员评论列表
            
            
            
});
Route::get('/admin/login/log','Admin\LoginController@login');//登陆

Route::post('/admin/login/login','Admin\LoginController@log');//登陆验证

Route::get('/admin/login/{tmp}','Admin\LoginController@code');//验证码 




//前台登陆页面
             Route::get('/home/login','Home\IndexController@login');
             Route::post('/home/log','Home\IndexController@log');

//前台页面路由 
Route::group(['namespace' => 'home', 'prefix' => 'home'], function() {
            //前台首页  
             Route::get('index','IndexController@index');
             
             //前台列表页
             Route::get('list/{id}','IndexController@g_list');
             
             //前台详情页面
             Route::get('xiangqing/{id}','IndexController@xiangqing');
             
             //前台注册页面
             Route::get('register','IndexController@register');
             Route::post('regist','IndexController@regist');    
             
});
             //购物车
             Route::get('/home/cart','Home\IndexController@cart')->middleware('home.log'); 
             Route::get('/home/InsertCart/{id}','Home\IndexController@InsertCart');//加入购物车
             Route::get('/home/ChangeNum/{num}','Home\IndexController@ChangeNum');//改变商品数量
             //订单
             Route::get('/home/orders/{ids}','Home\IndexController@orders');
             Route::post("/home/addr","Home\IndexController@addr");
             